CC 			= gcc
LD 			= gcc


#Pour NCURSES:
	SRCS_NCUR = Chevalet.c Jeu.c Joueur.c main_ncur.c ncurJeu.c SacLettres.c Terrain.c Verification.c
	FINAL_TARGET_NCUR = wordlif7_txt
	LIBS_NCUR = -lncurses

#Pour SDL:
	SRCS_SDL = Chevalet.c Jeu.c Joueur.c SacLettres.c Terrain.c sdlJeu.c main_sdl.c Verification.c sdlUtilitaires.c
	FINAL_TARGET_SDL = wordlif7_gfx
	LIBS_SDL = -lSDL_ttf -lSDL

#Pour les tests de régression
	SRCS_TEST = Chevalet.c Jeu.c Joueur.c SacLettres.c Terrain.c main_testReg.c Verification.c
	FINAL_TARGET_TEST = wordlif7_test



CFLAGS 			= -Wall -pedantic -ansi -ggdb   #-O2   # pour optimiser
INCLUDE_DIR 		= -I/usr/include -Isrc -I"C:\Program Files (x86)\PDCurses-SO" -I/usr/include/SDL -I"G:\alex\A_CLASSER\LIF7-DeveloppementApp\SDL-1.2.14\include\SDL"

OBJ_DIR 		= bin
SRC_DIR 		= src
BIN_DIR 		= bin

default: $(BIN_DIR)/$(FINAL_TARGET_NCUR) $(BIN_DIR)/$(FINAL_TARGET_SDL)

sdl: $(BIN_DIR)/$(FINAL_TARGET_SDL)

ncurs: $(BIN_DIR)/$(FINAL_TARGET_NCUR)

test:  $(BIN_DIR)/$(FINAL_TARGET_TEST)


$(BIN_DIR)/$(FINAL_TARGET_NCUR): $(SRCS_NCUR:%.c=$(OBJ_DIR)/%.o)
	$(LD) $+ -o $@ $(LDFLAGS) $(LIB_DIR) $(LIBS_NCUR)

$(BIN_DIR)/$(FINAL_TARGET_SDL): $(SRCS_SDL:%.c=$(OBJ_DIR)/%.o)
	$(LD) $+ -o $@ $(LDFLAGS) $(LIB_DIR) $(LIBS_SDL)

$(BIN_DIR)/$(FINAL_TARGET_TEST): $(SRCS_TEST:%.c=$(OBJ_DIR)/%.o)
	$(LD) $+ -o $@ $(LDFLAGS) $(LIB_DIR)

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
	$(CC) -c $(CFLAGS) $(INCLUDE_DIR) $< -o $@

clean:
	rm -r -f $(OBJ_DIR)/*.o $(BIN_DIR)/* 
